import axios from 'axios'
import http from '@/http/index'

export async function list() {
  const res = await http({
    method: 'GET',
    path: '/api/users',
    params: {}
  })
  return res
}
export async function save(params: any) {
  const res = await http({
    method: 'POST',
    path: '/api/users',
    params,
  })
  return res
}
export async function update(params: any) {
  const res = await http({
    method: 'PUT',
    path: '/api/users',
    params,
  })
  return res
}

export async function login(params: any) {
  const res = axios.post('/api/users/login', params)
  return res
  // axios.post('/api/users/test-bcrypt', params).then((res) => {
  //   console.log(res)
  //   return res
  // })
}

export async function resetPassword(params: any) {
  const res = await http({
    method: 'PUT',
    path: '/api/users/reset-password',
    params,
  })
  return res
}

export async function updatePassword(params: any) {
  const res = await http({
    method: 'PUT',
    path: '/api/users/password',
    params,
  })
  return res
}